package com.service.impl;

import com.bean.Supplier;
import com.dao.SupplierDao;
import com.dao.impl.SupplierDaoImpl;
import com.service.SupplierService;

import java.util.List;

public class SupplierServiceImpl implements SupplierService {
    private SupplierDao supplierDao = new SupplierDaoImpl();
    @Override
    public List<Supplier> getAllSupplier() {
        return supplierDao.getAllSupplier();
    }

    @Override
    public boolean addSupplier(String customerName, String director, String directorTel, String address, String manageRange) {
        if (supplierDao.addSupplier(customerName,director,directorTel,address,manageRange) > 0) {
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateSupplier(int key, String tel, String director) {
        if (supplierDao.updateSupplier(key,tel,director) > 0) {
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Supplier getSupplierInfo(int key) {
        return supplierDao.getSupplierInfo(key);
    }

    @Override
    public List<Supplier> findSupplier(String supplierName, String manageRange) {
        return supplierDao.findSupplier(supplierName,manageRange);
    }
}
